package com.fenghongzhang.day012eventbus;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

public class MainActivity extends AppCompatActivity {
    private EditText edit;
    private Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        edit = (EditText) findViewById(R.id.edit);
        btn = (Button) findViewById(R.id.btn);


    }

    public void btn(View view) {
        String string = edit.getText().toString();
        //发布//publish
        EventBus.getDefault().post(string);
//        EventBus.getDefault().postSticky(string);
//        Intent intent = new Intent(this, Main2Activity.class);
//        startActivity(intent);
    }



}
